<!--conf
<sample in_favorites="true">
              <product version="1.4" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               <sampledescription><![CDATA[Rows can be dropped from TreeGrid to Grid and vica versa. Try this out with this sample. ]]></sampledescription></sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Drag and Drop between Grids</title>
	
    	<link rel="STYLESHEET" type="text/css" href="../../../dhtmlxGrid/codebase/dhtmlxgrid.css">
	<script src="../../../dhtmlxGrid/codebase/dhtmlxcommon.js" type="text/javascript"></script>
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
	<script  src="../../codebase/dhtmlxtreegrid.js"></script>
	<script  src="../../../dhtmlxGrid/codebase/ext/dhtmlxgrid_drag.js"></script>
    <script  src="../../../dhtmlxGrid/codebase/ext/dhtmlxgrid_math.js"></script>

</head>

<body>
<link rel='STYLESHEET' type='text/css' href='../common/style.css'>
<table cellspacing="0" cellpadding="0" class="sample_header" border="0">
	<tr valign="middle">
		<!-- COMPONENT ICON -->
		<td width="40" align="center"><img src="../common/dhtmlxtreegrid_icon.gif" border="0"></td>
		<!-- COMPONENT NAME -->
		<td width="150" align="left" nowrap="true">Sample: dhtmlxTreeGrid</td>
		<!-- SAMPLE TITLE -->
		<td width="0" align="left" nowrap><b>Drag and Drop between Grids</b></td>
		<!-- LINK TO COMPONENT PAGE -->
		<td width="0" align="right"><a href="http://www.dhtmlx.com/docs/products/dhtmlxTreeGrid/index.shtml">dhtmlxTreeGrid main page</a></td>
		<!-- CLOSE BUTTON -->
		<td width="50"><div class="sample_close"><a href="javascript:void(0);" onclick="self.close();"><img src="../common/sample_close.gif" width="14" height="14" border="0" alt="X"></a></div></td>
	</tr>
</table>
	
	
	<p>
            Drag-n-drop within Grid(TreeGrid), between Grids(TreeGrids)
	</p>


	<table width="1000px">
		<tr>
			<td width="500px">
				<div id="gridbox" width="100%" height="250px" style="background-color:white;"></div>
			</td>
            <td>
				<div id="gridbox2" width="100%" height="250px" style="background-color:white;"></div>
            </td>
		</tr>
		<tr>
			<td>
				<div id="gridbox3" width="100%" height="250px" style="background-color:white;"></div>
			</td>
		</tr>

	</table>



<script>
		mygrid = new dhtmlXGridObject('gridbox');

		mygrid.selMultiRows = true;
		mygrid.setImagePath("../../../dhtmlxGrid/codebase/imgs/icons_books/");
		
		mygrid.setHeader("Tree,Plain Text,Long Text,Color,Checkbox");
		mygrid.setInitWidths("150,100,100,100,100")
		mygrid.setColAlign("left,left,left,left,center")
		mygrid.setColTypes("tree,ed,txt,ch,ch");
		mygrid.setColSorting("str,str,str,na,str")
        mygrid.enableDragAndDrop(true);
        mygrid.enableSmartXMLParsing(false)
		mygrid.init();
	   	mygrid.loadXML("test_list_1.xml");

		mygrid2 = new dhtmlXGridObject('gridbox2');

		mygrid2.selMultiRows = true;
		mygrid2.setImagePath("../../../dhtmlxGrid/codebase/imgs/icons_books/");
    	mygrid2.setHeader("Title,Price,Quantity,Total");
    	mygrid2.setInitWidths("120,120,120,120")
    	mygrid2.setColAlign("left,right,right,right")
    	mygrid2.setColTypes("tree,price,ed[=sum],price[=sum]");
    	mygrid2.setColSorting("str,int,int,int")
    	mygrid2.setColumnColor("#d5f1ff")
        mygrid2.setMathRound(2);
        mygrid2.enableDragAndDrop(true);
		mygrid2.init();
		mygrid2.enableSmartXMLParsing(false)
	   	mygrid2.loadXML("treegrid_sample.xml");



		mygrid3 = new dhtmlXGridObject('gridbox3');

		mygrid3.selMultiRows = true;
		mygrid3.setImagePath("../../../dhtmlxGrid/codebase/imgs/");
		var flds = "Sales,Book Title,Author,Price";
		flds += ",In Store,Shipping,Bestseller,Date of Publication";
		mygrid3.setHeader(flds);
		mygrid3.setInitWidths("50,150,120,80,80,80,80,200")
		mygrid3.setColAlign("right,left,left,right,center,left,center,center")
		mygrid3.setColTypes("dyn,ed,ed,price,ch,coro,ra,ro");
		mygrid3.setColSorting("int,str,str,int,str,str,str,date")
		mygrid3.setColumnColor("white,#d5f1ff,#d5f1ff")
		mygrid3.rowsBufferOutSize = 0;
		mygrid3.setMultiLine(false);
		mygrid3.enableDragAndDrop(true);
		mygrid3.selmultirows="true"
		


		mygrid3.init();
	   	mygrid3.loadXML("grid.xml");


        mygrid3.gridToGrid=function(rowId,sgrid,tgrid){
            var z=new Array();
            for (var i=0; i<sgrid.hdr.rows[0].cells.length; i++)
                z[i+1]=sgrid.cells(rowId,i).getValue();

    	    return z;
        }
</script>

<!-- FOOTER -->
<table callspacing="0" cellpadding="0" border="0" class="sample_footer"><tr><td style="padding-left: 8px;">&copy; <a href="http://www.dhtmlx.com">DHTMLX LTD</a>. All rights reserved</td></tr></table>
<!-- FOOTER -->

</body>
</html>
